checkLogin(true);
$(function () {
    $("#btn-sure").on("click", function () {
        var id = $.cookie("user_id");
        var old = $("#old").val();
        var newPwd = $("#password").val();
        var con = $("#confirm").val();
        if (newPwd != con) {
            layer.alert("您两次输入的密码不一致，请重新输入", {icon: 2});
            return;
        }
        $.post("../php/users/updatePassword.php", {id: id, old: old, newPwd: newPwd}, function (res) {
            console.log(res);
            if (res.code == 100) {
                layer.alert(res.msg, {icon: 1}, function (index) {
                    window.top.location.href = "login.html";
                });
            }
            else {
                layer.alert(res.msg);
            }
        }, "json")
    })
});